#include "xmppcore/protocolrelation.h"

namespace yoohoo_xmppcore {

ProtocolRelation::ProtocolRelation(ProtocolKey enclosing, ProtocolKey embedded) :
_enclosing(enclosing), _embedded(embedded) {
}

void ProtocolRelation::setEnclosing(ProtocolKey enclosing) {
	_enclosing = enclosing;
}

ProtocolKey ProtocolRelation::enclosing() const {
	return _enclosing;
}

void ProtocolRelation::setEmbedded(ProtocolKey embedded) {
	_embedded = embedded;
}

ProtocolKey ProtocolRelation::embedded() const {
	return _embedded;
}

bool ProtocolRelation::operator==(const ProtocolRelation& other) const {
	return (_enclosing == other._enclosing) && (_embedded == other._embedded);
}

uint qHash(const ProtocolRelation& protocolRelation) {
	return qHash(protocolRelation.enclosing()) + qHash(protocolRelation.embedded());
}

}
